<div class="header dmz-blue">
  <div class="text-center">测试报告
    <button nz-button nzType="text" (click)="print()" class="text-white float-right"><i nz-icon nzType="printer" nzTheme="outline"></i></button>

  </div>
</div>
<div class="p-2" *ngIf="report">
  <div nz-row>
    <div nz-col nzSpan="12">
      <label class="item-label">测试设备: </label><label>{{report.device}}</label>
    </div>
    <div nz-col nzSpan="12">
      <label class="item-label">测试人员: </label><label>{{report.testUser}}</label>
    </div>
    <div nz-col nzSpan="12">
      <label class="item-label">测试时间: </label><label>{{report.testTime}}</label>
    </div>
    <div nz-col nzSpan="12">
      <label class="item-label">测试状态: </label><label>{{report.status}}</label>
    </div>
    <div class="item-label">测试说明:</div>
    <div style=";width: calc(100% - 85px)">
      {{report.desc}}
    </div>
  </div>
  <div>
    <div class="panel-title">
      设备基本信息
    </div>
    <!--<div nz-row>
      <div nz-col nzSpan="12"><label class="item-label">电脑型号 </label><label>宏碁 TravelMate TX520-G2-MG 笔记本电脑 (扫描时间：2021年01月08日)</label></div>
      <div nz-col nzSpan="12"><label class="item-label">操作系统 </label><label>Windows 10 专业版 64位 ( DirectX 12 )</label></div>
      <div nz-col nzSpan="12"><label class="item-label">处理器 </label><label>英特尔 Core i5-8250U @ 1.60GHz 四核</label></div>
      <div nz-col nzSpan="12"><label class="item-label">主板 </label><label>KBL Aquila_KL ( 7th/8th Generation Intel Processor Family I/O - 9D4E 笔记本芯片组 )</label></div>
      <div nz-col nzSpan="12"><label class="item-label">内存 </label><label>8 GB ( 海力士 DDR4 2400MHz )</label></div>
      <div nz-col nzSpan="12"><label class="item-label">主硬盘 </label><label>SK HYNIX HFS256G39TND-N210A ( 256 GB / 固态硬盘 )</label></div>
      <div nz-col nzSpan="12"><label class="item-label">主显卡 </label><label>Nvidia GeForce MX130 ( 2 GB / 宏碁 )</label></div>
      <div nz-col nzSpan="12"><label class="item-label">显示器 </label><label>奇美 CMN15D5 ( 15.5 英寸 )</label></div>
      <div nz-col nzSpan="12"><label class="item-label">声卡 </label><label>瑞昱 @ 英特尔 High Definition Audio 控制器</label></div>
      <div nz-col nzSpan="12"><label class="item-label">网卡 </label><label>英特尔 Ethernet Connection I219-LM / 宏碁</label></div>
    </div>-->
    <div nz-row>
      <div nz-col nzSpan="12"><label class="item-label">电脑型号 </label><label>{{report.json.baseInfo.basicInfo.model}}</label></div>
      <div nz-col nzSpan="12"><label class="item-label">操作系统 </label><label>{{report.json.baseInfo.basicInfo.os}}({{report.json.baseInfo.basicInfo.osArch}})</label></div>
      <div nz-col nzSpan="12"><label class="item-label">处理器 </label><label>{{report.json.baseInfo.cpu[0].name}}</label></div>
      <div nz-col nzSpan="12"><label class="item-label">主板 </label><label>{{report.json.baseInfo.baseBoard.Product}}</label></div>
      <div nz-col nzSpan="12">
        <label class="item-label">内存 </label>
        <label class="item-value">
          <nz-tag nzColor="#55acee" *ngFor="let item of memoryInfo">
            <span>{{item}}</span>
          </nz-tag>
        </label>
      </div>
      <div nz-col nzSpan="12">
        <label class="item-label">硬盘 </label>
        <label class="item-value">
          <nz-tag nzColor="#bbbbbb" *ngFor="let item of diskInfo">
            <span>{{item}}</span>
          </nz-tag>
        </label>
      </div>
      <div nz-col nzSpan="12">
        <label class="item-label">显卡 </label>
        <label class="item-value">
          <nz-tag nzColor="#77bbcc" *ngFor="let item of gpuInfo">
            <span>{{item}}</span>
          </nz-tag>
        </label>

      </div>
      <!--      <div nz-col nzSpan="12"><label class="item-label">显示器 </label><label>奇美 CMN15D5 ( 15.5 英寸 )</label></div>
            <div nz-col nzSpan="12"><label class="item-label">声卡 </label><label>瑞昱 @ 英特尔 High Definition Audio 控制器</label></div>
            <div nz-col nzSpan="12"><label class="item-label">网卡 </label><label>英特尔 Ethernet Connection I219-LM / 宏碁</label></div>-->
    </div>
  </div>
  <div *ngIf="interfaceTestList.length>0">
    <div class="panel-title">
      设备接口
    </div>
    <div>
      <div *ngFor="let item of interfaceTestList">
        <ng-container *ngTemplateOutlet="testItem; context:{item:item}"></ng-container>


      </div>
    </div>
  </div>

  <div>
    <div class="panel-title">
      设备状态
    </div>
    <div nz-row>
      <div style="width: 250px;height: 300px" echarts [options]="cpuTemperatureOptions"></div>
      <div style="width: 250px;height: 300px" echarts [options]="gpuTemperatureOptions"></div>
      <div style="width: 250px;height: 300px" echarts [options]="fanSpeedOptions"></div>
      <div style=";width: calc(100% - 750px);padding-top: 50px;">
        <div *ngFor="let item of statusTestList">
          <ng-container *ngTemplateOutlet="testItem; context:{item:item}"></ng-container>
        </div>
      </div>
    </div>
  </div>
  <div *ngIf="performanceTestList.length>0">
    <div class="panel-title">
      设备性能
    </div>
    <div nz-row>
      <div style="width: 50%;height: 400px" echarts *ngFor="let item of performanceTestList" [options]="getPerformanceOption(item)"></div>
    </div>
  </div>

</div>

<ng-template #testItem let-item='item'>
  <nz-row>
    <nz-col style="width: 180px;"><label><b>{{item.title}}</b></label></nz-col>
    <ng-container *ngIf="item.result; else noResult">
      <nz-col style="width: 120px;">
        <div *ngIf="item.result.passed==='Y'" class="text-success">
          <i nz-icon nzType="check" nzTheme="outline" class="float-left" style="padding-top: 5px;"></i>
          <label>测试通过</label>
        </div>
        <div *ngIf="item.result.passed==='N'" class="text-danger">
          <i nz-icon nzType="close" nzTheme="outline" class="float-left" style="padding-top: 5px;"></i>
          <label>测试不通过</label>
        </div>


      </nz-col>
      <nz-col style="width: calc(100% - 300px)">
        <label style="color: #666; font-size: 14px;">
          {{item.result.info}}
        </label>
      </nz-col>
    </ng-container>
    <ng-template #noResult>
      <nz-col style="width: 120px;">

        <div class="text-warning">
          <i nz-icon nzType="exclamation" nzTheme="outline" class="float-left" style="padding-top: 5px;"></i>
          <label>未测试</label>
        </div>


      </nz-col>
    </ng-template>

  </nz-row>
</ng-template>
